<div class="links view">
  <div style="width:620px;">
    <?=$this->element('link',array('link'=>$link,'type'=>'view')) ?>
    <div id="comments">
      <h2><? printf(__('%d comments',true),$link['Link']['comment_count']) ?></h2>
    	<?
    	foreach ($comments as $comment){
    		echo $this->element('comment',array('comment'=>$comment));
    	}    	   	    	
    	
    	if($numbers=$paginator->numbers()){
    		echo $paginator->prev('« Previous ', null, null, array('class' => 'disabled')).
		 	$numbers.$paginator->next(' Next »', null, null, array('class' => 'disabled'));
    	}
    	?> 
      <h3>Add comment</h3>
      <div id="commentForm"> 
  	  <?=$this->element('commentform',array('link_id'=>$link['Link']['id'])) ?>
	  </div>
    </div>
  </div>
</div>
<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('Edit Link', true), array('action' => 'edit', $link['Link']['id'])); ?> </li>
		<li><?php echo $this->Html->link(__('Delete Link', true), array('action' => 'delete', $link['Link']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $link['Link']['id'])); ?> </li>
		<li><?php echo $this->Html->link(__('List Links', true), array('action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Link', true), array('action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Blogs', true), array('controller' => 'blogs', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Blog', true), array('controller' => 'blogs', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Categories', true), array('controller' => 'categories', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Category', true), array('controller' => 'categories', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Comments', true), array('controller' => 'comments', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Comment', true), array('controller' => 'comments', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Favorites', true), array('controller' => 'favorites', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Favorite', true), array('controller' => 'favorites', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Tags', true), array('controller' => 'tags', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Tag', true), array('controller' => 'tags', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Trackbacks', true), array('controller' => 'trackbacks', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Trackback', true), array('controller' => 'trackbacks', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Votes', true), array('controller' => 'votes', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Vote', true), array('controller' => 'votes', 'action' => 'add')); ?> </li>
	</ul>
</div>
<div class="related">
	<h3><?php __('Related Comments');?></h3>
	<?php if (!empty($link['Comment'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('Type'); ?></th>
		<th><?php __('Randkey'); ?></th>
		<th><?php __('Parent'); ?></th>
		<th><?php __('Link Id'); ?></th>
		<th><?php __('User Id'); ?></th>
		<th><?php __('Created'); ?></th>
		<th><?php __('Modified'); ?></th>
		<th><?php __('Ip'); ?></th>
		<th><?php __('Order'); ?></th>
		<th><?php __('Votes'); ?></th>
		<th><?php __('Karma'); ?></th>
		<th><?php __('Content'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($link['Comment'] as $comment):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $comment['id'];?></td>
			<td><?php echo $comment['type'];?></td>
			<td><?php echo $comment['randkey'];?></td>
			<td><?php echo $comment['parent'];?></td>
			<td><?php echo $comment['link_id'];?></td>
			<td><?php echo $comment['user_id'];?></td>
			<td><?php echo $comment['created'];?></td>
			<td><?php echo $comment['modified'];?></td>
			<td><?php echo $comment['ip'];?></td>
			<td><?php echo $comment['order'];?></td>
			<td><?php echo $comment['votes'];?></td>
			<td><?php echo $comment['karma'];?></td>
			<td><?php echo $comment['content'];?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'comments', 'action' => 'view', $comment['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'comments', 'action' => 'edit', $comment['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'comments', 'action' => 'delete', $comment['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $comment['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('New Comment', true), array('controller' => 'comments', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>
<div class="related">
	<h3><?php __('Related Favorites');?></h3>
	<?php if (!empty($link['Favorite'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('User Id'); ?></th>
		<th><?php __('Type'); ?></th>
		<th><?php __('Link Id'); ?></th>
		<th><?php __('Date'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($link['Favorite'] as $favorite):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $favorite['user_id'];?></td>
			<td><?php echo $favorite['type'];?></td>
			<td><?php echo $favorite['link_id'];?></td>
			<td><?php echo $favorite['date'];?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'favorites', 'action' => 'view', $favorite['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'favorites', 'action' => 'edit', $favorite['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'favorites', 'action' => 'delete', $favorite['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $favorite['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('New Favorite', true), array('controller' => 'favorites', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>
<div class="related">
	<h3><?php __('Related Tags');?></h3>
	<?php if (!empty($link['Tag'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Link Id'); ?></th>
		<th><?php __('Lang'); ?></th>
		<th><?php __('Created'); ?></th>
		<th><?php __('Name'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($link['Tag'] as $tag):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $tag['link_id'];?></td>
			<td><?php echo $tag['lang'];?></td>
			<td><?php echo $tag['created'];?></td>
			<td><?php echo $tag['name'];?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'tags', 'action' => 'view', $tag['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'tags', 'action' => 'edit', $tag['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'tags', 'action' => 'delete', $tag['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $tag['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('New Tag', true), array('controller' => 'tags', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>
<div class="related">
	<h3><?php __('Related Trackbacks');?></h3>
	<?php if (!empty($link['Trackback'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('Link Id'); ?></th>
		<th><?php __('User Id'); ?></th>
		<th><?php __('Type'); ?></th>
		<th><?php __('Status'); ?></th>
		<th><?php __('Created'); ?></th>
		<th><?php __('Ip Int'); ?></th>
		<th><?php __('Link'); ?></th>
		<th><?php __('Url'); ?></th>
		<th><?php __('Title'); ?></th>
		<th><?php __('Content'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($link['Trackback'] as $trackback):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $trackback['id'];?></td>
			<td><?php echo $trackback['link_id'];?></td>
			<td><?php echo $trackback['user_id'];?></td>
			<td><?php echo $trackback['type'];?></td>
			<td><?php echo $trackback['status'];?></td>
			<td><?php echo $trackback['created'];?></td>
			<td><?php echo $trackback['ip_int'];?></td>
			<td><?php echo $trackback['link'];?></td>
			<td><?php echo $trackback['url'];?></td>
			<td><?php echo $trackback['title'];?></td>
			<td><?php echo $trackback['content'];?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'trackbacks', 'action' => 'view', $trackback['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'trackbacks', 'action' => 'edit', $trackback['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'trackbacks', 'action' => 'delete', $trackback['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $trackback['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('New Trackback', true), array('controller' => 'trackbacks', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>
<div class="related">
	<h3><?php __('Related Votes');?></h3>
	<?php if (!empty($link['Vote'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __('Id'); ?></th>
		<th><?php __('Type'); ?></th>
		<th><?php __('Created'); ?></th>
		<th><?php __('Link Id'); ?></th>
		<th><?php __('User Id'); ?></th>
		<th><?php __('Value'); ?></th>
		<th><?php __('Ip Int'); ?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($link['Vote'] as $vote):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>
			<td><?php echo $vote['id'];?></td>
			<td><?php echo $vote['type'];?></td>
			<td><?php echo $vote['created'];?></td>
			<td><?php echo $vote['link_id'];?></td>
			<td><?php echo $vote['user_id'];?></td>
			<td><?php echo $vote['value'];?></td>
			<td><?php echo $vote['ip_int'];?></td>
			<td class="actions">
				<?php echo $this->Html->link(__('View', true), array('controller' => 'votes', 'action' => 'view', $vote['id'])); ?>
				<?php echo $this->Html->link(__('Edit', true), array('controller' => 'votes', 'action' => 'edit', $vote['id'])); ?>
				<?php echo $this->Html->link(__('Delete', true), array('controller' => 'votes', 'action' => 'delete', $vote['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $vote['id'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('New Vote', true), array('controller' => 'votes', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>
